const express = require('express');
const path = require('path');
const cookieParser = require('cookie-parser');
const logger = require('morgan');
const cors = require('cors')
require('dotenv').config();

// 引用路由
const userRouter = require('./routes/user/KouZi');
const TheWeatherRouter = require('./routes/user/TheWeather');
const WenBenShenHe = require('./routes/user/WenBenShenHe')
const DuanXin = require('./routes/user/DuanXin')

const app = express();

app.use(logger('dev'));
app.use(express.json());
app.use(express.urlencoded({ extended: false }));
app.use(cookieParser());
app.use(express.static(path.join(__dirname, 'public')));

// CORS跨域配置
const corsOptions = {
    origin:''
}
app.use(cors())

// 路由配置
app.use('/BuBsLeQr/kouzi',userRouter)
app.use('/BuBsLeQr/theweather', TheWeatherRouter)
app.use('/BuBsLeQr/wenbenshenhe',WenBenShenHe)
app.use('/BuBsLeQr/duanxin',DuanXin)


module.exports = app;
